import React from 'react';
import { Descriptions } from 'antd';
import { getDicByKey } from '@/support/common';

import PropTypes from 'prop-types';

export default class ChargingTab extends React.Component<any, any> {
  static contextTypes = {
    dicData: PropTypes.any,
  };

  render() {
    const { chargeData2 } = this.props;
    const { context } = this;
    let chargeData = chargeData2 || {};
    return (
      <>
        <Descriptions bordered size="small" style={{ overflow: 'hidden' }}>
          <Descriptions.Item label="充电状态">
            {getDicByKey(context.dicData, 'chargeStatus2', chargeData.chargeStatus)}
          </Descriptions.Item>
          <Descriptions.Item label="剩余充电时间(min)">
            {chargeData.remainingChargingTime ? `${chargeData.remainingChargingTime}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="充电功率(kw)">
            {chargeData.chargingPower ? `${chargeData.chargingPower}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="充电电流(A)">
            {chargeData.chargingCurrent ? `${chargeData.chargingCurrent}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="充电电压(V)">
            {chargeData.chargingVoltage ? `${chargeData.chargingVoltage}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="SOC(%)">
            {chargeData.soc ? `${chargeData.soc}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="纯电续航里程">
            {chargeData.pureElectricRange ? `${chargeData.pureElectricRange}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="燃油续航里程">
            {chargeData.fuelMileage ? `${chargeData.fuelMileage}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="慢充充电口盖状态">
            {chargeData.slowCcpStatus === '0'
              ? '充电口盖关闭'
              : chargeData.slowCcpStatus === '1'
              ? '充电扣盖开启'
              : ''}
          </Descriptions.Item>
          <Descriptions.Item label="快充充电口盖状态">
            {chargeData.quickCcpStatus === '0'
              ? '充电口盖关闭'
              : chargeData.slowCcpStatus === '1'
              ? '充电扣盖开启'
              : ''}
          </Descriptions.Item>
          <Descriptions.Item label="慢充枪插拔状态">
            {chargeData.slowCgpStatus === '0'
              ? '插枪状态'
              : chargeData.slowCgpStatus === '1'
              ? '拔枪状态'
              : ''}
          </Descriptions.Item>
          <Descriptions.Item label="快充枪插拔状态">
            {chargeData.quickCgpStatus === '0'
              ? '插枪状态'
              : chargeData.slowCgpStatus === '1'
              ? '拔枪状态'
              : ''}
          </Descriptions.Item>
          <Descriptions.Item label="本次充电时长">
            {chargeData.totalChargingTime ? `${chargeData.totalChargingTime}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label="增加续航里程">
            {chargeData.chargingIncreasesMileage ? `${chargeData.chargingIncreasesMileage}` : ''}
          </Descriptions.Item>
          <Descriptions.Item label=""></Descriptions.Item>
        </Descriptions>
      </>
    );
  }
}
